package com.zh.chat.convert;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class DateFormatUtil {
	private static SimpleDateFormat sdf= null;
	public static String toStr(Date source,String format){
		DateFormatUtil.sdf = new SimpleDateFormat(format);
		return sdf.format(source);
	}
	public static Date toDate(String str,String format){
		DateFormatUtil.sdf = new SimpleDateFormat(format);
		Date date = null;
		try {
			date = sdf.parse(str);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return date;
	}
}
